<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

<f:view >
	<a4j:form>
		<rich:panel>
        <f:facet name="header">
        	<h:outputText value="Rejestracja nowego przedmiotu"/>
        </f:facet>
        <h:panelGrid columns="2" >
        	<h:outputText value="Nazwa" />
			<h:inputText value="#{przedmiot.nazwa}" id="name1" required="true"/>
			<rich:message for="name1" />
				<h:commandButton  action="#{przedmiot.dodaj}" id="rejestruj_przedmiot"   value="Dodaj" />
		</h:panelGrid>
    	</rich:panel>
	</a4j:form>
</f:view>
<a4j:jsFunction name="ajaxSubmit" oncomplete="#{rich:component('panel')}.show()" reRender="panel" />
 <rich:modalPanel id="panel" width="350" height="100" showWhenRendered="#{przedmiot.mp.wynik}">
        <f:facet name="header">
            <h:outputText value="#{przedmiot.mp.naglowek}"></h:outputText>
        </f:facet>
        <f:facet name="controls">
            <h:panelGroup>
            	<h:commandButton   id="hidelink" value="X"/>
                <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
            </h:panelGroup>
        </f:facet>
        <h:outputText value="#{przedmiot.mp.tresc}"/>
    </rich:modalPanel>
</html>